<%@ taglib uri='http://java.sun.com/jsp/jstl/core' prefix='c'%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ page import="java.util.*" %>
<%@ page import=" src.entities.*" %>
<%@ page import="queries.*" %>
<%
DBConnector dbConnect = new DBConnector();
SecurityQueries security = null;
UserManagementQueries umq = null; 

	security = new SecurityQueries(dbConnect.getConnection());
	umq = new UserManagementQueries(dbConnect.getConnection(), security);
	ArrayList<User> users = umq.getUserList();
	int size = users.size();
	pageContext.setAttribute("size", size);
%>

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>RIS Login</title>

<link rel="stylesheet" href="css/reset.css"> 
<link rel="stylesheet" href="css/text.css"> 
<link rel="stylesheet" href="css/typography.css">
<link rel="stylesheet" href="css/style.css">  
<link rel="stylesheet" href="css/smoothness/jquery-ui-1.8.11.custom.css">
</head>

<body>
<h1>Radiology Information System</h1>
<c:choose>
<c:when test="${size > 0}">
<fieldset>
<legend>Login</legend>
<form name="login" action="LoginServlet" method="post" id="login">
${messages.login_msg}
${messages.new_user_msg}
	<label for="username">Username</label>
	<input type="text" value="" name="username" />

	<label for="password">Password</label>
	<input type="password" value="" name="password" />

<input type="submit" name="submit" value="submit" />
</form>
</fieldset>
</c:when>
<c:otherwise>
	<h2>Add Admin Account</h2>
	<fieldset>
		${messages.new_user_msg}
		<form class="user_info" id="add_user_form" name="first_user" method="post" action="FirstUser">
			<label for="username">Username:</label>
			<input class="required" name="username" type="text" value=""> 
	
			<label for="password" >Password:</label>
			<input class="required" name="password" type="password" value=""> 

			<input type="hidden" name="userclass" value="a">

			<label for="first_name">First Name:</label>
			<input name="first_name" type="text" value=""> 
	
			<label for="last_name">Last Name:</label>
			<input name="last_name" type="text" value=""> 		
			
			<label for="address">Address:</label>
			<input name="address" type="text" value=""> 		
	
			<label for="email">Email:</label>
			<input class="required email" name="email" type="text" value=""> 		
	
			<label for="phone">Phone (10 digits):</label>
			<input name="phone" type="text" value=""> 				
	
			<input type="submit" value="submit">
		</form>	
	</fieldset>
</c:otherwise>
</c:choose>
<%@ include file="footer.jsp" %>